package com.cwd.arm.domain.entity;

import com.cwd.arm.common.util.BigDecimalUtil;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;

/**
* Description:收款记录
* Created on 2021年11月16日
* @author  yan
*/
@Data
public class ReceiveRecordEntity {

    private Long id;

    /**
    * 项目id
    */
    private Long projectId;

    /**
    * 收款节点id
    */
    private Long receiveNodeId;

    /**
    * 开票id
    */
    private Long taxId;

    /**
    * 收款金额
    */
    private BigDecimal amount;

    /**
    * 收款时间
    */
    private Date receiveDate;

    /**
    * 支付方式: 10 现金;20;承兑30;其他99
    */
    private String payType;

    /**
    * 承兑类型:10银行承兑;20商誉;99其他
    */
    private String honorPayType;

    private Date honorEndDate;

    /**
    * 承兑惠票号码
    */
    private String honorTaxNo;

    /**
    * 贴现税点
    */
    private BigDecimal honorTaxRate;

    /**
    * 备注
    */
    private String remak;


    public void undo(){
        amount = BigDecimalUtil.minus(amount);
    }

    public void initAmount(ReceiveRecordEntity oldReceiveRecordEntity){
        if(oldReceiveRecordEntity!=null){
            if(amount == null){
                amount = oldReceiveRecordEntity.getAmount();
            }
        }
    }


}
